package com.factory.rental.repository;

import com.factory.rental.model.Contract;
import com.factory.rental.model.Room;
import com.factory.rental.model.Tenant;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.List;
import java.util.Optional;

@Repository
public interface ContractRepository extends JpaRepository<Contract, Long> {
    Optional<Contract> findByContractNumber(String contractNumber);
    List<Contract> findByTenant(Tenant tenant);
    List<Contract> findByRoom(Room room);
    List<Contract> findByStatus(Contract.ContractStatus status);
    List<Contract> findByEndDateBetween(LocalDate start, LocalDate end);
    List<Contract> findByStartDateBeforeAndEndDateAfter(LocalDate date1, LocalDate date2);
}